﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

using Fif.arg;
using Fif.wss;
using Fif.text;

namespace Fif
{    
    public class Program
    {
        [STAThread]
        static int Main(string[] args)
        {
            var Params = new Args(args);
            Params.Validate();

            if (!string.IsNullOrEmpty(Params.Index))
            {
                Manager.AddToIndex(Params.Index);
            }
            else
            {
                // Manager.AddToIndex(Params.Path);            
                var files = new Search().FindInFiles(Params.Text, Params.Path, Params.Lang);
                var output = new Output(Params.File);
                output.WriteToFile(Params.Lang, Params.Text, Params.Path, files);
            }            

            return 0;
        }      
    }
}
